var utils = {
  a: 'hello',
  uniqueId: function (arr) {
    var result = [], isRepeated
    for (var i = 0, len = arr.length; i < len; i++) {
      isRepeated = false
      for (var j = 0, len = result.length; j < len; j++) {
        if (arr[i].flyInfoMain.id === result[j].flyInfoMain.id) {
          isRepeated = true
          break
        }
      }
      if (!isRepeated) {
        result.push(arr[i])
      }
    }
    return result
  },
  uniqueSum: function (arr) {
    var result = [], isRepeated
    for (var i = 0, len = arr.length; i < len; i++) {
      isRepeated = false
      for (var j = 0, len = result.length; j < len; j++) {
        if (arr[i].aircraftType === result[j].aircraftType) {
          isRepeated = true
          break
        }
      }
      if (!isRepeated) {
        result.push(arr[i])
      }
    }
    return result
  },
  title: function (val) {
    document.title = val
  },
  getQueryString: function (name) {
    var originUrl = location.search //获取url中"?"符后的字串
    var theRequest = {}
    if (originUrl.indexOf('?') != -1) {
      let str = originUrl.substr(1)
      let strs = str.split('&')
      for (let i = 0; i < strs.length; i++) {
        theRequest[strs[i].split('=')[0]] = unescape(strs[i].split('=')[1])
      }
    }
    return theRequest[name]
  },
  sleep: function (d) {
    while (Date.now - t <= d);
  }

}
export default utils
